package com.teamwork.ZuccEcho.Entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

////答卷里题目的回答
//@Entity
//@Table(name = "Answer", schema = "", catalog = "")
//public class Answer {
//    private long a_id;//id
////    private long asId;//该回答对应的答卷id
//    private int a_qtypes;//问题类型 1.单选；2.多选；3.填空；4.比重
//    private String a_content;//回答的内容
//
//    @Id
//    @Column(name = "aId")
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    public long getaId() {
//        return aId;
//    }
//
//    public void setaId(long aId) {
//        this.aId = aId;
//    }
//
//    @Basic
//    @Column(name = "qTypes")
//    public int getqTypes() {
//        return qTypes;
//    }
//
//    public void setqTypes(int qTypes) {
//        this.qTypes = qTypes;
//    }
//
//    @Basic
//    @Column(name = "answerContent")
//    public String getAnswerContent() {
//        return answerContent;
//    }
//
//    public void setAnswerContent(String answerContent) {
//        this.answerContent = answerContent;
//    }
//
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        Answer that = (Answer) o;
//        return aId == that.aId &&
//                Objects.equals(qTypes, that.qTypes) &&
//                Objects.equals(answerContent, that.answerContent);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(aId, qTypes, answerContent);
//    }
//}

//答卷里题目的回答
@Entity
//@Data
@Setter
@Getter
public class Answer {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long a_id;//id
    @Column(nullable = true)//允许为null
    private int a_qtypes;//问题类型 1.单选；2.多选；3.填空；4.比重
    private String a_content;//回答的内容

    @ManyToOne
    @JoinColumn(name="as_id",nullable=false)//在子表中的外键名
    private Answersheet answersheet;//答卷

    @Override
    public String toString() {
        return "Answer{" +
                "a_id=" + a_id +
                ", a_qtypes=" + a_qtypes +
                ", a_content='" + a_content + '\'' +
                '}';
    }
}